package com.blt.car.login;

import android.view.View;

import com.blt.car.R;
import com.blt.car.base.BaseActivity;
import com.blt.car.base.ViewHolder;

import blt.app_core.api.base.CoreEvent;
import blt.app_core.api.login.LoginApi;
import blt.app_core.log.Logger;

/**
 * Created by xgp on 2017/6/11.
 */

public class InitActivity extends BaseActivity implements View.OnClickListener {


    @Override
    protected int getLayoutId() {
        return R.layout.activity_init;
    }

    @Override
    protected void initView(ViewHolder holder) {
        holder.get(R.id.to_login);
        holder.get(R.id.to_register);
        holder.setOnClickListener(this, R.id.to_login, R.id.to_register);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.to_login) {
            openActivity(LoginActivity.class);
        } else if (v.getId() == R.id.to_register) {
            openActivity(RegisterActivity.class);
        }

    }

    @CoreEvent(coreClientClass = LoginApi.class)
    public void onLogin() {
        //登陆成功关闭activity,避免按返回键回到该界面
        finish();
    }

}
